package com.project.server.service.estates.impl;

import com.project.common.core.domain.BaseServer;
import com.project.server.domain.estates.TServiceRecord;
import com.project.server.mapper.estates.TServiceRecordMapper;
import com.project.server.service.estates.ITServiceRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 服务记录Service业务层处理
 *
 * @author project
 * @date 2021-06-28
 */
@Service
public class TServiceRecordServiceImpl extends BaseServer implements ITServiceRecordService {

    private static final Logger log = LoggerFactory.getLogger(TServiceRecordServiceImpl.class);

    @Resource
    private TServiceRecordMapper tServiceRecordMapper;

    /**
     * 查询服务记录
     *
     * @param serviceId 服务记录ID
     * @return 服务记录
     */
    @Override
    public TServiceRecord selectTServiceRecordById(Long serviceId) {
        return tServiceRecordMapper.selectTServiceRecordById(serviceId);
    }

    /**
     * 根据用户微信opneid查询服务记录
     *
     * @param openId 用户微信openid
     * @return 服务记录
     */
    @Override
    public TServiceRecord selectTServiceRecordByOpenId(String openId) {
        return tServiceRecordMapper.selectTServiceRecordByOpenId(openId);
    }

    /**
     * 查询服务记录列表
     *
     * @param tServiceRecord 服务记录
     * @return 服务记录
     */
    @Override
    public List<TServiceRecord> selectTServiceRecordList(TServiceRecord tServiceRecord) {
        return tServiceRecordMapper.selectTServiceRecordList(tServiceRecord);
    }

    /**
     * 新增服务记录
     *
     * @param tServiceRecord 服务记录
     * @return 结果
     */
    @Override
    public int insertTServiceRecord(TServiceRecord tServiceRecord) {
        super.insert(tServiceRecord);
        return tServiceRecordMapper.insertTServiceRecord(tServiceRecord);
    }

    /**
     * 用户修改服务记录
     *
     * @param tServiceRecord 服务记录
     * @return 结果
     */
    @Override
    public int updateTServiceRecord(TServiceRecord tServiceRecord) {
        super.update(tServiceRecord);
        return tServiceRecordMapper.updateTServiceRecord(tServiceRecord);
    }

    /**
     * 用户修改服务记录
     *
     * @param tServiceRecord 服务记录
     * @return 结果
     */
    @Override
    public int updateTServiceRecordByUserId(TServiceRecord tServiceRecord) {
        super.update(tServiceRecord);
        return tServiceRecordMapper.updateTServiceRecordByUserId(tServiceRecord);
    }

    /**
     * 服务人员修改服务记录
     *
     * @param tServiceRecord 服务记录
     * @return 结果
     */
    @Override
    public int updateTServiceRecordByServerId(TServiceRecord tServiceRecord) {
        return tServiceRecordMapper.updateTServiceRecordByServerId(tServiceRecord);
    }

    /**
     * 修改服务状态
     *
     * @param tServiceRecord 服务记录
     * @return 结果
     */
    @Override
    public int changeTServiceRecordStatus(TServiceRecord tServiceRecord) {
        return tServiceRecordMapper.changeTServiceRecordStatus(tServiceRecord);
    }

    @Override
    public int addServiceEvaluate(TServiceRecord tServiceRecord) {
        return tServiceRecordMapper.addServiceEvaluate(tServiceRecord);
    }

    /**
     * 添加用户评价
     *
     * @param tServiceRecord 服务记录
     * @return 结果
     */

    /**
     * 批量删除服务记录
     *
     * @param serviceIds 需要删除的服务记录ID
     * @return 结果
     */
    @Override
    public int deleteTServiceRecordByIds(Long[] serviceIds) {
        return tServiceRecordMapper.deleteTServiceRecordByIds(serviceIds);
    }

    /**
     * 删除服务记录信息
     *
     * @param serviceId 服务记录ID
     * @return 结果
     */
    @Override
    public int deleteTServiceRecordById(Long serviceId) {
        return tServiceRecordMapper.deleteTServiceRecordById(serviceId);
    }
}
